package com.oig.sys.auth.dto;


import com.oig.common.constants.CommonEnum;
import com.oig.common.validator.EnumValue;
import com.oig.common.validator.GroupAdd;
import com.oig.common.validator.GroupEdit;
import io.swagger.v3.oas.annotations.media.Schema;

import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

@Data
@Schema(description = "接口权限参数")
public class PermissionDto {

    @Schema(description = "主键id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "参数错误,id不能为空", groups=GroupEdit.class)
    private Integer id;

    @Schema(description = "所属系统", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "参数错误，所属系统不能为空", groups={GroupAdd.class, GroupEdit.class})
    private Integer systemId;

    @Schema(description = "接口相对地址", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotEmpty(message = "参数错误，接口地址不能为空", groups={GroupAdd.class, GroupEdit.class})
    private String apiUrl;

    @Schema(description = "接口名称")
    private String apiName;

    @Schema(description = "api说明")
    private String apiDesc;

    //是否是 开放资源
    @Schema(description = "是否是开放资源 0-授权资源 1-开放资源 可以不配 默认0")
    @EnumValue(message = "数据过滤类型值不正确",enumClass = CommonEnum.FlagEnum.class, enumValidMethod = "validCode", groups={GroupAdd.class, GroupEdit.class})
    private String flag;	//0-授权资源 1-开放资源

}
